<?php

namespace App\Models;

use App\Enums\OrderStatusEnum;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class OrderModel extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'orders';
    protected $guarded=['id'];

    function getCodeStrAttribute(){
        return substr($this->attributes['code'],0,6).'********'.substr($this->attributes['code'],-4);
    }

    function getStatusStrAttribute(){
        return OrderStatusEnum::getDescription($this->attributes['status']);
    }
}
